// @ts-ignore
/* eslint-disable */
import { request } from '@umijs/max';

/** 获取租户列表 GET /api/tenants/list */
export async function tenantList(
  params: {
    // query
    /** 当前的页码 */
    current?: number;
    /** 页面的容量 */
    pageSize?: number;
  },
  options?: { [key: string]: any },
) {
  return request<API.TenantList>(API_URL + '/api/tenants/list', {
    method: 'POST',
    data: {
      ...params,
      ...(options || {}),
    },
    
  });
}

/** 获取所有租户 */
export async function allTenantList() {
  return request<API.TenantList>(API_URL + '/api/tenants', {
    method: 'GET'
  });
}


/** 新建 POST /api/tenants */
export async function addTenant(options?: { [key: string]: any }) {
  let formData = new FormData();
  formData.append('file', options?.dat[0]?.originFileObj); // 添加文件
  formData.append('tenantName', options?.tenantName); // 添加字符串数据
  return request<API.TenantItem>(API_URL + '/api/tenants', {
    method: 'POST',
    data: formData,
  });
}

/** 更新 PUT /api/tenants */
export async function updateTenant(options?: { [key: string]: any }) {
  debugger
  let formData = new FormData();
  formData.append('file', options?.dat[0]?.originFileObj); // 添加文件
  formData.append('tenantId', options?.selectUpdateTenant?.tenantId); // 添加字符串数据
  return request<API.TenantItem>(API_URL + '/api/tenants', {
    method: 'PUT',
    data: formData,
  });
}

/** 删除 DELETE /api/tenants */
export async function removeTenant(options?: { [key: string]: any }) {
  return request<Record<string, any>>(API_URL + '/api/tenants', {
    method: 'DELETE',
    data: {
      ...(options || {}),
    },
  });
}

